import request from '@/utils/request'

const roleApi = {
  list: '/boss/system/role/list',
  roleList: '/common/getSystemRole',
  add: '/boss/system/role/add',
  del: '/boss/system/role/delete',
  upData: '/boss/system/role/update',
  userRole: '/boss/system/role/getPms',

  // 项目角色
  listByPro: '/boss/pro/role/list',
  addByPro: '/boss/pro/role/add',
  delByPro: '/boss/pro/role/delete',
  upDataByPro: '/boss/pro/role/update',
  userRoleByPro: '/boss/pro/role/getPms',
  projectUserRole: '/boss/pro/role/copy',
  systemUserRole: '/boss/system/role/copy'
}

export function getRoleList (parameter) {
  return request({
    url: roleApi.list,
    method: 'post',
    data: parameter
  })
}

export function roleList (parameter) {
  return request({
    url: roleApi.roleList,
    method: 'post',
    data: parameter
  })
}

export function addRole (parameter) {
    return request({
      url: roleApi.add,
      method: 'post',
      data: parameter
    })
  }
  export function upDataRole (parameter) {
    return request({
      url: roleApi.upData,
      method: 'post',
      data: parameter
    })
  }
  export function delRole (parameter) {
    return request({
      url: roleApi.del,
      method: 'post',
      data: parameter
    })
  }

  export function getRoleDetail (parameter) {
    return request({
      url: roleApi.add,
      method: 'post',
      data: parameter
    })
  }

  export function userRole (parameter) {
    return request({
      url: roleApi.userRole,
      method: 'post',
      data: parameter
    })
  }

  export function getRoleListByPro (parameter) {
    return request({
      url: roleApi.listByPro,
      method: 'post',
      data: parameter
    })
  }

  export function addRoleByPro (parameter) {
      return request({
        url: roleApi.addByPro,
        method: 'post',
        data: parameter
      })
    }
    export function upDataRoleByPro (parameter) {
      return request({
        url: roleApi.upDataByPro,
        method: 'post',
        data: parameter
      })
    }
    export function delRoleByPro (parameter) {
      return request({
        url: roleApi.delByPro,
        method: 'post',
        data: parameter
      })
    }

    export function userRoleByPro (parameter) {
      return request({
        url: roleApi.userRoleByPro,
        method: 'post',
        data: parameter
      })
    }

    export function getProjectUserRole (parameter) {
      return request({
        url: roleApi.projectUserRole,
        method: 'post',
        data: parameter
      })
    }

    export function getSystemUserRole (parameter) {
      return request({
        url: roleApi.systemUserRole,
        method: 'post',
        data: parameter
      })
    }
